using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Text;
using Beetle;

internal class p
{
	private class a
	{
		public string a;

		public string b;

		public a()
		{
			a = ar.a();
			b = ar.b();
		}

		[SpecialName]
		public string c()
		{
			return f(a);
		}

		[SpecialName]
		public string d()
		{
			return f(b);
		}
	}

	public bool a;

	public string b;

	public string c;

	public int d;

	public DateTime e;

	private static p m_f;

	private static RSACryptoServiceProvider m_g;

	private static string m_h;

	private static string i;

	private static a j;

	private static string[] k;

	private static string[] l;

	private static DateTime m;

	private static char[] n;

	static p()
	{
		p.m_f = null;
		p.m_g = null;
		j = new a();
		m = DateTime.Now;
		n = new char[2] { '\r', '\n' };
		p.m_g = (RSACryptoServiceProvider)ar.c();
	}

	public static bool f(string A_0, string A_1)
	{
		return f(Encoding.UTF8.GetBytes(A_0), Convert.FromBase64String(A_1));
	}

	public static bool f(byte[] A_0, byte[] A_1)
	{
		return p.m_g.VerifyData(A_0, "MD5", A_1);
	}

	public static string h(string A_0)
	{
		return Encoding.UTF8.GetString(f(Convert.FromBase64String(A_0)));
	}

	public static byte[] f(byte[] A_0)
	{
		return p.m_g.Decrypt(A_0, fOAEP: false);
	}

	private static void g(string A_0)
	{
		k = A_0.Split(n, StringSplitOptions.RemoveEmptyEntries);
		if (f(k[0], k[1]))
		{
			l = Encoding.UTF8.GetString(Convert.FromBase64String(k[0])).Split(';');
			g();
			p.m_f.e = new DateTime(long.Parse(l[3]));
			p.m_f.a = p.m_f.e > m;
		}
	}

	private static void g()
	{
		p.m_f.b = l[0];
		p.m_f.c = l[1];
		p.m_f.d = int.Parse(l[2]);
	}

	public static p f()
	{
		lock (typeof(p))
		{
			if (p.m_f == null)
			{
				p.m_f = new p();
				try
				{
					p.m_g.FromXmlString(j.c());
					string path = TcpUtils.h() + j.d();
					using StreamReader streamReader = new StreamReader(path);
					g(streamReader.ReadToEnd());
				}
				catch (Exception)
				{
				}
			}
		}
		y.c = p.m_f.a;
		return p.m_f;
	}

	internal static string f(string A_0)
	{
		ah ah2 = new ah();
		ah.a a2 = new ah.a();
		a2.a(Convert.FromBase64String(TcpServer.g));
		a2.b(Convert.FromBase64String(aq.z));
		ah2.a(a2);
		return ah2.b(A_0);
	}

	public bool f(int A_0)
	{
		if (this.a)
		{
			return A_0 <= d;
		}
		return false;
	}
}
